import Vue from "vue";
import Vuex from "vuex";
import persistedState from "vuex-persistedstate";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    token: "", //token
    num: 88,
    powerCode: 0,
    adminCount: 0,
    studentCount: 0,
    list: [], //面包屑导航数据
  },
  mutations: {
    setToken(state, token) {
      state.token = token;
    },
    setList(state, list) {
      state.list = list;
    },
    setPower(state, powerCode) {
      state.powerCode = powerCode;
    },
    setAdminCount(state, num) {
      state.adminCount = num;
    },
    setStudentCount(state, num) {
      state.studentCount = num;
    },
  },
  actions: {
    ActionToken({ commit }, token) {
      commit("setToken", token);
    },
  },
  getters: {
    token: (state) => state.token,
    list: (state) => state.list,
  },
  modules: {},
  plugins: [persistedState()],
});
